package robotleMvc.frameworks.ground.model
{
	import _Pan3D.core.MathCore;
	import _Pan3D.display3D.Display3DContainer;
	import _Pan3D.program.Program3DManager;
	import _Pan3D.program.shaders.GroundShader;
	
	import flash.display3D.Context3D;
	import flash.display3D.Program3D;
	
	import org.robotlegs.mvcs.Actor;
	
	import test.vo.GroundDisplay3DSprite;
	import test.vo.StatVO;
	// --------------MSN:lation_pan@live.cn  QQ: 3423526------------- //
	public class GroundModel extends Actor
	{
		public var groundItem:Array;
		public var context3D:Context3D;
		public var display3DContainer:Display3DContainer;
		
		//解析地面的模型数据。
		public function praseGroundXmltoItem(_xml:XML):void
		{
			var _item:Array =MathCore.getSourcePro(_xml);


			_item=new Array;
			for(var u:int=0;u<221;u++){
				var obj:Object=new Object;
				obj.x=0;
				obj.y=0-120;
				obj.z=0;
				obj.scale=1;
				obj.type=1;
				obj.et=String(u)+"dixing";
				_item.push(obj);
			}
	


			groundItem=new Array;
			var _groundItem:Array=groundItem;
			for(var  i:int=0;i<_item.length;i++){
				var statVO:StatVO=new StatVO;
				statVO.et=_item[i].et;
				statVO.scale=_item[i].scale;
				statVO.x=_item[i].x;
				statVO.y=_item[i].y;
				statVO.z=_item[i].z;
				statVO.type=_item[i].type;
				statVO.name=_item[i].name;
				_groundItem.push(statVO);
			}
			for(var j:int=0;j<_groundItem.length;j++){
				var tempVo:StatVO=_groundItem[j] as StatVO;
				var sp1:GroundDisplay3DSprite =new GroundDisplay3DSprite(context3D);
				sp1.url =tempVo.et
				sp1.x=tempVo.x
				sp1.y=tempVo.y;
				sp1.z=tempVo.z;
				sp1.scale=tempVo.scale;
				display3DContainer.addChild(sp1);
				
			}
			var treeShaderProgram3d:Program3D = Program3DManager.getInstance().getProgram(  GroundShader.GROUND_SHADER);
			display3DContainer.setProgram3D(treeShaderProgram3d);
			
		}
	}
}